package com.woniuxy.order.service.impl;

import com.woniuxy.order.entity.OrderLog;
import com.woniuxy.order.mapper.OrderLogMapper;
import com.woniuxy.order.repository.OrderLogRepository;
import com.woniuxy.order.service.IOrderLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2025-05-13
 */
@Service
public class OrderLogServiceImpl extends ServiceImpl<OrderLogMapper, OrderLog> implements IOrderLogService {

    @Resource
    OrderLogRepository orderLogRepository;

    @Override
    public void logUserAction(String logDesc, String logUser, Integer orderId) {

        OrderLog orderLog = new OrderLog();
        orderLog.setOrderId(orderId);
        orderLog.setLogUser(logUser);
        orderLog.setLogDesc(logDesc);
        orderLog.setLogTime(LocalDateTime.now());

        orderLogRepository.insert(orderLog);
    }
}
